/*
 * Copyright (c) 1995-2009
 *     J.J. Lukkien
 *     Department of Mathematics and Computer Science
 *     Eindhoven University of Technology
 *     P.O. Box 513
 *     5600 MB Eindhoven, The Netherlands
 *
 * File:    random.h
 * Version: derived from RCS
 *
 * A random generator, described by Donald Knuth in The Stanford GraphBase,
 * A Platform for Combinatorial Computing.
 * The user is not supposed to call gb_flip_cycle () or use gb_fptr.
 * A call to initrandom initializes the random generator.
 * random     returns a number in the range [0..2^31), uniform distribution.
 * unifrandom returns a number in the range [0..m),    uniform distribution.
 *
 * Functions are renamed as follows:
 *  Knuth         here
 * =======================
 * gb_next_rand  random
 * gb_init_rand  initrandom
 * gb_unif_rand  unifrandom
 */

extern void initrandom   ( int seed );
extern int unifrandom   ( int m );

#define     random() ( *gb_fptr >= 0 ? *gb_fptr-- : gb_flip_cycle () )

extern int *gb_fptr;         /* The next value of A to be used        */
extern int gb_flip_cycle (); /* Compute 55 more pseudo-random numbers */


#undef RAND_MAX
#define RAND_MAX ((unsigned int) 0x80000000)
